home *** CD-ROM | disk | FTP | other *** search
/ Products & Services for NeXT / Products & Services for NeXT.iso / AlembicDemo.app / Axone / AddIn / MesaAddIn.h < prev    next >
Text File  |  1994-03-06  |  12KB  |  304 lines

  1. /**************************************************************************
  2.  *                                                                        *
  3.  *                                                                        *
  4.  *          This code is copyright (c) 1992                               *
  5.  *                     Athena Design, Inc.                                *
  6.  *                     and David Pollak                                   *
  7.  *                                                                        *
  8.  *                ALL RIGHTS RESERVED                                     *
  9.  *                                                                        *
  10.  *                                                                        *
  11.  *                                                                        *
  12.  *                                                                        *
  13.  *                                                                        *
  14.  **************************************************************************/
  15.  
  16. int mesaVersion();
  17. char *versionString();
  18.  
  19. #ifndef LITE
  20. /**************************************************************************
  21.  
  22.     This header file defines the data structures and functions needed to
  23.     impliment a function add-in.
  24.  
  25.  **************************************************************************/
  26.  
  27. #import "MesaError.h"
  28. #import "objc/Object.h"
  29. #import <appkit/View.h>
  30. #import "MesaObjectLibraryInterface.h"
  31.  
  32. typedef enum {numberAddInValue = 0,stringAddInValue,addressAddInValue,
  33.     rangeAddInValue,errorAddInValue} AddInValueType;
  34.  
  35. typedef struct _AddInValue {
  36.     int type;
  37.     union {
  38.         char *string;
  39.         double number;
  40.         int error;
  41.         struct {
  42.             short row1,col1,row2,col2;
  43.             void *cells;
  44.             } ad;
  45.         } values;
  46.     } AddInValue;
  47.  
  48. /*
  49.  
  50.     These functions allow you to push and pop items from the stack
  51.  
  52. */
  53.  
  54. int numberOfItemsOnStack(void *);
  55. void popValueFromStack(void *,AddInValue *);
  56. void pushNumberOnStack(void *,double);
  57. void pushStringOnStack(void *,const char *);
  58. void pushErrorOnStack(void *,int);
  59. void pushAddressOnStack(void *,short,short,void *);
  60. void pushRangeOnStack(void *,short,short,short,short,void *);
  61.  
  62.  
  63. /*
  64.     These functions allow you to manipulate values
  65. */
  66.  
  67. void initAddInValue(AddInValue *);
  68. void freeAddInValue(AddInValue *);
  69. double getAddInValueNumber(AddInValue *,int *);
  70. void getAddInValue(AddInValue *,AddInValue *,int *);
  71.  
  72. /*
  73.  
  74.     This function allows you to get the value for a cell
  75.  
  76. */
  77.  
  78. int getValueForCell(void *,short,short,int *,AddInValue *);
  79.  
  80.  
  81. /*
  82.  
  83.     get the sheet from the information passed
  84.     **WARNING - DO NOT USE ANY EVENTADDIN METHOD CALLS FROM WITHIN A FUNCTION ADDIN!!!
  85.     
  86. */
  87. id getSheetFromPointer(void *);
  88. void getCurrentAddress(void *,int *,int *);
  89.  
  90. @interface MesaAddIn : Object
  91. {
  92. }
  93.  
  94. + (char *)funcName;
  95. - execute:(void *)stack numberOfParams:(int)num sheet:(void *)sh;
  96. - beginRecalc;
  97. - endRecalc;
  98. @end
  99.  
  100. @interface Object (MesaAddIn)
  101.  
  102. + (int)numFuncs;
  103. + (char *)funcName:(int)functionNumber;
  104. - execute:(void *)stack numberOfParams:(int)num sheet:(void *)sh funcNumber:(int)fn;
  105. @end
  106.  
  107. // functions that are useful
  108. void addressToString(int,int,char *);  // converts a row and column to a string
  109. int stringToAddress(char *,int *,int *); // converts a string to a row and column ad
  110. int strToRange(char *,int *,int *,int *,int *);
  111. void rangeToString(int,int,int,int,char *);
  112. void freeAMOLIValue(MOLIValue *);
  113. void freeMOLIValues(MOLIValue *,int n);
  114.  
  115. @interface Object (EventAddIn)
  116.  
  117. + (char *)eventName;
  118. - sheetDidOpen:sender;
  119. - sheetWillClose:sender;
  120. - sheetDidClose:sender;
  121. - sheetDidRecalc:sender;
  122. - rangeDidRecalc:sender upperRow:(int)i1 col:(int)i2 lowerRow:(int)i3 col:(int)i4;
  123. - sheetDidRedisplay:sender;
  124. - dataEntered:sender string:(char *)s intoCellRow:(int)i1 col:(int)i2;
  125. - labelTableUpdated:sender;
  126. - sheetWillPrint:sender;
  127. - sheetDidPrint:sender;
  128. - pageWillPrint:sender page:(int)pn of:(int)of pageRect:(NXRect *)pr viewRect:(NXRect *)vr;
  129. - rangeCleared:sender upperRow:(int)i1 col:(int)i2 lowerRow:(int)i3 col:(int)i4;
  130. - sheetSizeChanged:sender toWidth:(int)w height:(int)h;
  131. - rangeSelected:sender upperRow:(int)i2 col:(int)i2 lowerRow:(int)i3 col:(int)i4;
  132. - doubleClick:sender onCellRow:(int)i1 col:(int)i2;
  133. - rangeFormatChanged:sender upperRow:(int)i1 col:(int)i2 lowerRow:(int)i3 col:(int)i4;
  134. - rangeCopied:sender fromUpperRow:(int)i1 col:(int)i2 lowerRow:(int)i3 col:(int)i4
  135.     toUpperRow:(int)i5 col:(int)i6 lowerRow:(int)i7 col:(int)i8;
  136. - rangeMoved:sender fromUpperRow:(int)i1 col:(int)i2 lowerRow:(int)i3 col:(int)i4
  137.     toUpperRow:(int)i5 col:(int)i6 lowerRow:(int)i7 col:(int)i8;
  138. - baseFormatChanged:sender;
  139. - addInScriptChanged:sender;
  140. // rev 110
  141. - sheetBecameTop:sender;
  142. - sheetResignedTop:sender;
  143.  
  144. - (const char *)next:(const char *)s;
  145.  
  146. // rev 162
  147. - (int)scriptFunc:(AddInValue *)aiv num:(int)nv return:(AddInValue *)airet sheet:sheet;
  148. @end
  149.  
  150. @interface Object (Sheet)
  151. - setPathName:(char *)s;
  152. - (int)totalRows;
  153. - (int)totalColumns;
  154. - (char *)sheetTitle;
  155. - save:sender;
  156. - saveAs:sender;
  157. - doRecalc;
  158. - (int) numberOfLabels;
  159. - (char *)getLabelNumber:(int)n;
  160. - deleteLabel:(char *)s;
  161. - redrawAll;
  162. - associateLabel:(char *)label with:(char **)tags and:(void *)mv num:(int)num
  163.     offset:(int)offset orientation:(int)orient;
  164. - performQuery:(char *)q;
  165. - (char *)getEventHeader:(char *)name;
  166. - setEventHeader:(char *)en forAddIn:(char *)ai;
  167. - updateDataEntry;
  168. - setChanged:(BOOL)b;
  169. - (BOOL)changed;
  170. - (int)numQueries;
  171. - (char *)nameOfQuery:(int)n;
  172. - performQuery:(char *)s;
  173. - (int)numReports;
  174. - (char *)getReportNumber:(int)n;
  175. - printReport:(char *)s;
  176.  
  177. - setRowSize:(int)size fromRow:(int)from to:(int)to;
  178. - setColSize:(int)size fromCol:(int)from to:(int)to;
  179. - setBestColSizeFrom:(int)from to:(int)to;
  180. - setBestRowSizeFrom:(int)from to:(int)to;
  181. - resetRowSizeFrom:(int)from to:(int)to;
  182. - resetColSizeFrom:(int)from to:(int)to;
  183. - (char *)getCellStringRow:(int)row col:(int)col;
  184. - setCellString:(char *)s row:(int)row col:(int)col;
  185. - setRangeUpperRow:(int)ur col:(int)uc lowerRow:(int)lr col:(int)lc toColor:(NXColor)c;
  186. - setRangeUpperRow:(int)ur col:(int)uc lowerRow:(int)lr col:(int)lc toAltColor:(NXColor)c;
  187. - setRangeUpperRow:(int)ur col:(int)uc lowerRow:(int)lr col:(int)lc toBkgColor:(NXColor)c;
  188. - setRangeUpperRow:(int)ur col:(int)uc lowerRow:(int)lr col:(int)lc toBorderColor:(NXColor)c;
  189. - setRangeUpperRow:(int)ur col:(int)uc lowerRow:(int)lr col:(int)lc toDefaultTextColor:(int)c;
  190. - setRangeUpperRow:(int)ur col:(int)uc lowerRow:(int)lr col:(int)lc toDefaultBkg:(int)c;
  191. - setRangeUpperRow:(int)ur col:(int)uc lowerRow:(int)lr col:(int)lc toDefaultAltColor:(int)c;
  192. - setRangeUpperRow:(int)ur col:(int)uc lowerRow:(int)lr col:(int)lc toDefaultBorderColor:(int)c;
  193. - setRangeUpperRow:(int)ur col:(int)uc lowerRow:(int)lr col:(int)lc toDefaultFont:(int)c;
  194. - setRangeUpperRow:(int)ur col:(int)uc lowerRow:(int)lr col:(int)lc toDefaultBorder:(int)c;
  195. - setRangeUpperRow:(int)ur col:(int)uc lowerRow:(int)lr col:(int)lc toDefaultAlignment:(int)c;
  196. - setRangeUpperRow:(int)ur col:(int)uc lowerRow:(int)lr col:(int)lc toDefaultDisplayFormat:(int)c;
  197. - setRangeUpperRow:(int)ur col:(int)uc lowerRow:(int)lr col:(int)lc toAlignment:(int)c;
  198. - setRangeUpperRow:(int)ur col:(int)uc lowerRow:(int)lr col:(int)lc toBaseFormat:(int)c;
  199. - setRangeUpperRow:(int)ur col:(int)uc lowerRow:(int)lr col:(int)lc toPrecision:(int)c;
  200. - setRangeUpperRow:(int)ur col:(int)uc lowerRow:(int)lr col:(int)lc toDisplayFormat:(int)c;
  201. - setRangeUpperRow:(int)ur col:(int)uc lowerRow:(int)lr col:(int)lc toBorder:(int)c;
  202. - setRangeUpperRow:(int)ur col:(int)uc lowerRow:(int)lr col:(int)lc toTopBorder:(int)c;
  203. - setRangeUpperRow:(int)ur col:(int)uc lowerRow:(int)lr col:(int)lc toBottomBorder:(int)c;
  204. - setRangeUpperRow:(int)ur col:(int)uc lowerRow:(int)lr col:(int)lc toLeftBorder:(int)c;
  205. - setRangeUpperRow:(int)ur col:(int)uc lowerRow:(int)lr col:(int)lc toRightBorder:(int)c;
  206. - setRangeUpperRow:(int)ur col:(int)uc lowerRow:(int)lr col:(int)lc toWrap:(int)c;
  207. - setRangeUpperRow:(int)ur col:(int)uc lowerRow:(int)lr col:(int)lc toBaseline:(int)c;
  208. - setRangeUpperRow:(int)ur col:(int)uc lowerRow:(int)lr col:(int)lc toFont:font;
  209. - setRangeUpperRow:(int)ur col:(int)uc lowerRow:(int)lr col:(int)lc toHasBkgColor:(int)c;
  210. - setRangeUpperRow:(int)ur col:(int)uc lowerRow:(int)lr col:(int)lc toMode:(int)c;
  211. - (char *)createGraphWithRect:(NXRect *)re type:(int)type upperRow:(int)ur col:(int)uc
  212.     lowerRow:(int)lr col:(int)lc;
  213. - (BOOL)findLabel:(char *)s upperRow:(int *)ur col:(int *)uc lowerRow:(int *)lr col:(int *)lc;
  214. - addLabel:(char *)s upperRow:(int)ur col:(int)uc lowerRow:(int)lr col:(int)lc;
  215. - moveRangeUpperRow:(int)sur col:(int)suc lowerRow:(int)slr col:(int)slc
  216.     toUpperRow:(int)dur col:(int)duc lowerRow:(int)dlr col:(int)dlc;
  217. - copyRangeUpperRow:(int)sur col:(int)suc lowerRow:(int)slr col:(int)slc
  218.     toUpperRow:(int)dur col:(int)duc lowerRow:(int)dlr col:(int)dlc;
  219. - associateRangeUpperRow:(int)ur col:(int)uc lowerRow:(int)lr col:(int)lc with:(char **)tags
  220.     and:(void *)mv num:(int)num offset:(int)offset orientation:(int)orient;
  221. - getMOLIValue:(void *)mv row:(int)row col:(int)col;
  222. - getMOLIValues:(void **)mv num:(int *)n upperRow:(int)ur col:(int)uc
  223.     lowerRow:(int)lr col:(int)lc;
  224. - putMOLIValues:(void *)mv num:(int)n upperRow:(int)ur col:(int)uc
  225.     lowerRow:(int)lr col:(int)lc;
  226. - putMOLIValue:(void *)mv row:(int)r col:(int)c;
  227.  
  228. // rev 110
  229. - currentRangeUpperRow:(int *)ur col:(int *)uc lowerRow:(int *)lr col:(int *)lc;
  230. - setRangeToDefaultsUpperRow:(int)ur col:(int)uc lowerRow:(int)lr col:(int)lc;
  231.  
  232. // rev 141
  233. - recalcRangeUpperRow:(int)ur andCol:(int)uc lowerRow:(int)lr andCol:(int)lc;
  234.  
  235. // rev 145
  236. - deleteScript:(char *)s;
  237. - (int)numScripts;
  238. - (char *)nameOfScript:(int)n;
  239. - runScript:(char *)s;
  240.  
  241. - setGridNXColor:(NXColor)nc;
  242. - setBkgNXColor:(NXColor)nc;
  243. - setGrid:(int)go;
  244. - setClearBkg:(int)cb;
  245. - setRowHeight:(int)rh;
  246. - setColWidth:(int)cw;
  247. - setAutoRecalcOn:(int)ar;
  248. - setMaxNumberOfRows:(int)nr;
  249. - setMaxNumberOfColumns:(int)nc;
  250. - miniturizeWindow:(int)win;
  251.  
  252. // rev 162
  253. - (NXColor)getTheGraphColor:(char *)graph item:(int)it;
  254. - setTheGraph:(char *)graph item:(int)it color:(NXColor)nc;
  255. - (NXColor)getTheGraphColor:(char *)graph element:(int)it;
  256. - setTheGraph:(char *)graph element:(int)it color:(NXColor)nc;
  257. - (int)getTheGraphInt:(char *)graph item:(int)it ;
  258. - setTheGraph:(char *)graph item:(int)it  intValue:(int)iv;
  259. - (char *)getTheGraphString:(char *)graph item:(int)it ;
  260. - setTheGraph:(char *)graph item:(int)it stringVal:(char *)sv;
  261. - (double)getTheGraphDouble:(char *)graph item:(int)it;
  262. - setTheGraph:(char *)graph item:(int)it doubleVal:(double)dv;
  263. - getTheGraphFont:(char *)graph item:(int)it ;
  264. - setTheGraph:(char *)graph item:(int)it font:fv;
  265. - getTheGraphRange:(char *)graph item:(int)it range:(int *)ur :(int *)uc :(int *)lr :(int *)lc;
  266. - setTheGraph:(char *)graph item:(int)it range:(int)ur :(int)uc :(int)lr :(int)lc;
  267.  
  268. // rev 163
  269. - setRangeUpperRow:(int)ur col:(int)uc lowerRow:(int)lr col:(int)lc toUnderline:(int)ul;
  270. - setRangeUpperRow:(int)ur col:(int)uc lowerRow:(int)lr col:(int)lc toDefaultUnderline:(int)ul;
  271. @end
  272.  
  273. @interface Object (DPApplication)
  274. - getOpenSheets;
  275. - openMesaFile:(const char *)path;
  276. - newWorksheet;
  277. - addMenuItem:(char *)name target:target action:(SEL)action;
  278. - removeMenuItem:item;
  279.  
  280. // rev 109+
  281. - setSubmenu:myMenu forItem:myItem;
  282.  
  283. // rev 110+
  284. - topSheet;
  285.  
  286. // rev 136
  287. - (const char *)pathToAddin:sender;
  288. @end
  289.  
  290. #define nullSQLValue -1
  291. #define numberSQLValue 1
  292. #define stringSQLValue 2
  293. #define dateSQLValue 3
  294.  
  295. #define noMoreSQLResults 2
  296. #define SQLSucceeded 1
  297. #define SQLFailed 0
  298. #define moreSQLRows -1
  299. #define noMoreSQLRows -2
  300. #define regSQLRow moreSQLRows
  301.  
  302.  
  303. #endif
  304.